<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!---
        我们某些情况下需要阻止默认行为的发生,比如阻止链接的跳转,表单域跳转
        语法:
            e.preventDefault();
    -->
    <form action="http://www.baidu.com">
        <input type="submit" value="提交">
    </form>

    <script>
        const form = document.querySelector('form');
        form.addEventListener('click',function(e){
            e.preventDefault();
        })
    </script>
</body>

</html>